<template>
  <div class="app">
    <a-config-provider :locale="locale.zhCN">
      <router-view v-if="isRouterAlive"></router-view>
    </a-config-provider>
  </div>
</template>

<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN';
import 'moment/locale/zh-cn';
import moment from 'moment';

moment.locale('zh-cn');

export default {
  data() {
    return {
      isRouterAlive: true,
      isDevelopment: null,
      locale: {
        zhCN,
      },
    };
  },
  mounted() {
    if (process.env.NODE_ENV === 'development') {
      this.isDevelopment = true;
    }
  },
  provide() {
    return {
      reload: this.reload,
    };
  },
  methods: {
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(() => {
        this.isRouterAlive = true;
      });
    },
  },
};
</script>
